<%
    Cookie[] cookies = request.getCookies();
    String lang = "CN";
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            String name = cookie.getName();
            String value = cookie.getValue();

            // 检查是否是我们想要的 cookie
            if ("lang".equals(name)) {
                // 找到了，可以获取 cookie 的值
                lang = value;
            }
        }
    }
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%="CN".equals(lang) ? "应用已启动!" : "application starting!"%> <br/>

    <a href="${pageContext.request.contextPath}/?lang=CN">中文</a> <br/>
    <a href="${pageContext.request.contextPath}/?lang=EN">English</a>
</body>
</html>
